In this project, you are going to build an app that will help in counting the vehicles pass by on your street. Each time a vehicle goes by, you will press the appropriate button to increment the count.
For each vehicle this will be
It should look like this:
3 seen
In Projects/Project-4-modules/ there are four .R files to get you started.
app.R is the usual structure for this workshop’s apps, withmuggle.R where you can put whatever Muggle code you want to writeUI-counter.R which defines a UI for one vehicle typeserver-components.R which contains the server components relating to the vehicle in the example UI.First, I want you to appreciate the problem that Shiny modules address. To this end …
"car"!) Keep in mind that you don’t want to have the same ID for different buttons.server-components.R, “copy” the components so that you have a counter and corresponding observeEvent()s to keep track of the count of cars.In muggle.R, write the two functions that describe a module. Let’s call them:
vehicle_UI() and vehicle(input, output, session).
The vehicle(...) function should return a reactive with the present count for its vehicle type.
| Vehicle | icon name | icon |
|---|---|---|
| automobile | "car" |
|
| bike | "bicycle" |
|
| truck | "truck" |
|
| bus | "bus" |
|
| motorcycle | "motorcycle" |
|
| helicopter | "helicopter" |
|
| airplane | "plane" |
|
| wheelchair | "wheelchair" |
|
| Mary Poppins | "umbrella" |